package cn.itsource.basic.domain;

import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.MD5;

public interface CreatePassword {

    String getSalt();

    void setSalt(String salt);

    String getPassword();

    void setPassword(String password);

    default void init(){
         //1.1生成盐值 hutool的
         String salt = IdUtil.fastSimpleUUID();
         //1.2生成加密字符串
         String pwd = MD5.create().setSalt(salt.getBytes()).digestHex(this.getPassword());

         this.setSalt(salt);
         this.setPassword(pwd);

    }

}
